****
| View of a binary operation between two sets. Handles union, intersection, diff and sym_diff Instead of copying the sets, it merely maintains pointers to the two sets. This view is read-only and *cannot* be used to modify the original sets. Note that it is *not* a value interface. In fact, if the original sets change, this view will automatically change. In some cases this is exactly the behavior you want; in other cases it can be a source of nasty problems. Use carefully.
_ Usage:
_____s1:_$SET{INT}_:=_#SET{INT}(|1,2,3,5|);
_____s2:_$SET{INT}_:=_#SET{INT}(|1,5,3,9|);
_____s_::=_BINOP_SET_VIEW{INT}::create_union(s1,s2);
_____#OUT+_s.str;
______--_will_print_out_the_elements_1,2,3,5,9_in_some_arbitrary_order
_____s2.delete(9);
_____#OUT+s.str;
______--_will_print_out_the_elements_1,2,3,5_in_some_arbitrary_order
_ Implementation:
_____Maintains_pointers_to_the_two_sets,_primary_and_secondary
_____The_space_of_the_final_set_is_broken_down_into:
_____Primary_set:_(_______primary_______________)__
_____Seconary_set:_______________(__________secondary_________)
_____Result:______(_p_minus_s____(_intersection_)__s_minus_p__)
____
_____The_flags_use_p_minus_s,_use_intersect_and_use_s_minus_p_indicate
_____which_part_should_be_used
|